package com.xmy.studentmanager.service;

import com.xmy.studentmanager.mapper.StudentMapper;
import com.xmy.studentmanager.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: xmy
 * @Date: 2019-04-23 13:38
 * @Version 1.0
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;

    /**
     * @description: 查询全部学生
     * @auther: XMY
     * @date: 2019-04-23 13:33
     */
    @Override
    public List<Student> selAllStudent(String name,Integer gradeId) {
        return studentMapper.selAllStudent(name,gradeId);
    }

    /**
     * @param id
     * @description: 根据id查询学生
     * @auther: XMY
     * @date: 2019-04-23 13:33
     */
    @Override
    public Student selStudentById(Integer id) {
        return studentMapper.selStudentById(id);
    }

    /**
     * @param student
     * @description: 新增学生
     * @auther: XMY
     * @date: 2019-04-23 13:35
     */
    @Override
    public int addStudent(Student student) {
        return studentMapper.addStudent(student);
    }

    /**
     * @param student
     * @description: 修改学生信息
     * @auther: XMY
     * @date: 2019-04-23 13:36
     */
    @Override
    public int updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    /**
     * @param id
     * @description: 删除学生
     * @auther: XMY
     * @date: 2019-04-23 13:37
     */
    @Override
    public int delStudent(Integer id) {
        return studentMapper.delStudent(id);
    }
}
